<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .iframeClass{
            height: 800px !important;
        }
    </style>
    <script src="../js/pages/public.js"></script>
    <!--引入ckeditor-->
    <script src="../js/jquery-2.1.1.min.js"></script>
    <script src="../js/ckeditor/ckeditor.js"></script>
    <link href="../js/ckeditor/contents.css" rel="stylesheet">

    <!--引入bootstrap-->
    <link href="../js/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="../js/bootstrap/js/bootstrap.min.js"></script>

    <!--引入bootstrap-treeview-->
    <link href="../js/bootstrap-treeview/dist/bootstrap-treeview.min.css" rel="stylesheet">
    <script src="../js/bootstrap-treeview/dist/bootstrap-treeview.min.js"></script>

    <!--引入bootStrap-addTabs-->
    <link href="../js/bootStrap-addTabs/bootstrap.addtabs.css" rel="stylesheet">
    <script src="../js/bootStrap-addTabs/bootstrap.addtabs.min.js"></script>

    <!--引入bootStrap-toastr-->
    <link href="../js/toastr/toastr.css" rel="stylesheet">
    <script src="../js/toastr/toastr.min.js"></script>

    <!--    bootstrap-table-->
    <link href="../js/bootstrap-table/dist/bootstrap-table.css" rel="stylesheet">
    <script src="../js/bootstrap-table/dist/bootstrap-table.js"></script>
    <script src="../js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js"></script><!--汉化文件-->

    <!--    bootstrap-fileinput-->
    <link href="../js/bootstrap-fileinput/css/fileinput.css" rel="stylesheet">
    <script src="../js/bootstrap-fileinput/js/fileinput.js"></script>
    <script src="../js/bootstrap-fileinput/js/locales/zh.js"></script>

    <!--    bootstrap-dialog-->
    <link href="../js/bootstrap-fileinput/js/bootstrap-dialog/dist/css/bootstrap-dialog.css" rel="stylesheet">
    <script src="../js/bootstrap-fileinput/js/bootstrap-dialog/dist/js/bootstrap-dialog.js"></script>

    <!--引入zTreev3-->
    <link href="../js/zTreev3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet">
    <script src="../js/zTreev3/js/jquery.ztree.all.js"></script>
    <title>Title</title>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-2">
            <div id="tree"></div>
        </div>
        <div class="col-sm-10">
            <ul class="nav nav-tabs" id="myTab"></ul>
            <div class="tab-content"></div>
        </div>
    </div>
</div>

<script>
    var token =window.localStorage.getItem("token");
    function getTree() {
        var tree ;
        $.ajax({
            url:domain+'/menu/BindMenuLogin',
            //contentType: "application/json; charset=utf-8",//这个是告诉后台我传的是json过去的
            type:"get",
            dataType: "json",
            async: false,
            headers:{"AutharizeToken":token},
            data:{},
            success: function (data) {
                tree=data.data;
            }, error: function (result) {
                alert(result.message)
            }
        })
        return tree;
    }
    $('#tree').treeview({
        data: getTree(),
        borderColor:"gray",
        selectedIcon: "glyphicon glyphicon-heart",
        collapseIcon: "glyphicon glyphicon-heart-empty",
        emptyIcon: "glyphicon glyphicon-star",
        expandIcon: "glyphicon glyphicon-star-empty"
    });

    $('#tree').on("nodeSelected",function (event, node){
        if(node.url!=undefined && node.url!=null && node.url != ''){
            if(node.text=="退出登录") {
                location.href = "/User/LoginOut";
                return;
            }
            if(node.url!=undefined){
                $.addtabs.add({
                    title:node.text,
                    url:node.url,
                    id:node.id
                });
            }
        }
    });
</script>
</body>
</html>